<?php $view->extend('template', 'content', array('title' => 'News: ' . $news->getTitle()))?>
<div class="col c6 news">
<h2><?php echo $news->getTitle()?></h2>
<div class="infopanel">
	<p><?php echo sprintf($view->lang->get('news')->get('news_meta'), $news->getDate()->format('jS F Y, g:i A'), $news->getAccount()->getUsername())?></p>
</div>
<div>
<?php echo $news->getText()?>
</div>





<?php if ($news->isCommentsEnabled()): ?>
<div>
	<?php if ($user): ?>
		<h2><?php echo $view->lang->get('news')->get('leave_a_reply')?></h2>
		<?php if ($reply): ?>
			<div class="grid_20 greybox">
				<p class="bar"><?php echo sprintf($view->lang->get('news')->get('answer_to'),$reply->getAccount() ? $reply->getAccount()->getUsername() : 'Anonymous')?></p>
				<p><?php echo $reply->getText()?></p>
			</div>
		<?php endif;?>
		<?php $view->import('commentform',array('commentForm' => $commentForm, 'reply' => $reply)); ?>
	<?php else: ?>
		<div class="message info"><p>
		<?php echo sprintf($view->lang->get('news')->get('please_login_comment'),$view->url->linkTo('Auth','login'))?>
		</p></div>
	<?php endif;?>
</div>
<?php endif;?>



</div>




<div class="col c6">

<?php if ($newsadmin): ?>
<div class="graybox">
<h2>News admin</h2>
<ul class="menu">
	<h4><a href="<?php echo $view->url->linkTo('Admin','news', array('delete', $news->getID()))?>">Delete News Article ( Can not be undone )</a></h4>
	<h4><a href="<?php echo $view->url->linkTo('Admin','news', array('edit', $news->getID()))?>">Edit</a></h4>

</ul>
</div>
<?php endif;?>


<?php if ($news->isCommentsEnabled()):  $comments = $news->getComments();?>
	<?php if (count($comments) > 0): ?>
		<h2><?php echo $view->lang->get('comment')->get('comments')?></h2>
		<?php foreach($comments as  $k => $comment):?>
			<?php $view->import('comment', array('comment' => $comment, 'num' => $k, 'replyToLink' => $replyToLink = function ($cid) use ($news, $view){
				return $view->url->linkTo('News','view', array('id' => $news->getID(), 'title' => $news->getUrl(), 'replyTo' => $cid));
			}))?>
		<?php endforeach;?>
	<?php endif; ?>
<?php endif;?>
</div>